#!/usr/bin/make -f
#
# Jailhouse, a Linux-based partitioning hypervisor
#
# Copyright (c) Siemens AG, 2019
#
# Authors:
#  Jan Kiszka <jan.kiszka@siemens.com>
#
# SPDX-License-Identifier: MIT
#

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

override_dh_auto_configure:
	test -e configure || ./bootstrap
	./configure --enable-local

override_dh_auto_build:
	$(MAKE)
	./ct-ng defconfig
	unset CFLAGS CXXFLAGS; ./ct-ng build

override_dh_auto_install:
	dh_install .install/* usr

override_dh_link:
	dh_link usr/bin/microblazeel-crosstool-elf-gcc usr/bin/mb-gcc
	dh_link usr/bin/microblazeel-crosstool-elf-ar usr/bin/mb-ar

override_dh_auto_clean:
	dh_auto_clean
	[ ! -d .install ] || chmod u+w -R .install
	rm -rf .build .install

%:
	dh $@ --parallel
